package com.itheima.zuoye2.zuoye3;

import java.math.BigDecimal;

public class GoldCard extends  Card{
    public GoldCard(String namuber, String name, String telephone, Double balance) {
        super(namuber, name, telephone, balance);

    }

    public GoldCard() {
    }

    @Override
    public void pay(double amount) {

        if (amount <= getBalance()) {
            // 减去支付金额使用bigdecimal

//            setBalance((new BigDecimal(getBalance()).subtract(new BigDecimal(amount*0.8)).doubleValue());
            System.out.println("金卡支付成功，支付金额：" + amount + "，当前余额：" + getBalance());
        } else {
            System.out.println("余额不足，支付失败！");
        }
    }

}
